package com.heima.search.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.search.dto.SearchDto;
import com.heima.search.service.SearchService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("api/v1/article/search")
public class SearchController {
    @Autowired
    private SearchService searchService;

    @PostMapping("search")
    public ResponseResult searchByKeyword(@RequestBody SearchDto searchDto) throws IOException {
        return searchService.searchByKey(searchDto);
    }

}
